<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<script type="text/javascript">
<!--
  // $(".ctcheckbox").at();
  /* alert($(".ctcheckbox").is(":visible") == false);
   if($(".ctcheckbox").is(":visible") == false)
   {
	   $(".cdeletet").click(function(){
		   $(".ctcheckbox").show();
	   });
   }
   else{*/
	  $(function(){
		  
		  var basePath = $("#base").val();
		  $(".deletet").click(function(){
			 // alert("asd");
			 var cclass ="."+ $(this).attr("cclass");
			 
			   var id="";
			  $(cclass).each(function(){
				  var tid = $(this).attr("tid");
				  if($(this).attr("checked") == true || $(this).attr("checked") == "checked")
				  {
					 id+=","+tid;
				  }
				 
			  }) ;
			 Boxy.confirm("<img src='../images/tixing.png' />确认移入校外人员！", function() { 
					 var uri = basePath + "backend/delteachers?id="+id ;
					 $.ajax({   
						 type: "get",  
						  url: uri,  
						  async:false,
						  data:"{}",
						  dataType : "jsonp",
						  jsonp: "callbackparam",//服务端用于接收callback调用的function名的参数
						 
						  jsonpCallback:"success_jsonpCallback",//callback的function名称
						  timeout: 15*1000,
						  success: function(data){ 
							 // alert(data);
							  if(data.success)
									
							  {   
								  alert("移入校外人员成功！");
							  
							  window.location.href = basePath+ "backend/teachermagui";
							  }else{
								  alert("出现错误，不能移入校外人员！");
							  }
						  },
						  error:function(result){
				              	alert("出现异常！请稍后再试！");
				              }
					  });
				 }, {title: "提示信息"});
		   });
		  });
			  
 
//-->
</script>
<c:if test="${message }">
	<div style='height: 70px; background-color: #eee;'>
		<table class='table' style='width: 100%;'>
			<tr>
				<td align="center"><strong
					style='color: #990000; font-size: 14px;'> <b>
							管理员：${user.realName }</b> , 添加教师成功，你可以继续<a
						href='<%=basePath%>backend/addteacherui'>添加</a>！
				</strong></td>
			</tr>
		</table>
	</div>
</c:if>
<!-- 师资队伍 -->
<div class="span12" id="body-content">
	<div class="panel">
		<div class="panel-heading"
			style="background-color: #e9d555; color: #eee;">教师管理</div>
		<c:forEach items="${departments }" var="department"
			varStatus="status1">
			<div style="padding: 20px; font-size: 28px;">
				<ul class="nav nav-pills">
					<li class="active"><a
						href='<%=basePath %>academygk/zdetail/${department.dId}'
						style="width: 400px; text-align: center"> ${department.dName}
					</a></li>
				</ul>
			</div>
			<c:set var="length" value="${fn:length(teachers[status1.count-1] ) }"></c:set>
			<div style="padding: 20px;">
				<table class='table table-bordered'
					style="background-color: #FAFAFA;">
					<c:forEach begin="1" end="${length }" step="6" varStatus="status">
						<tr class="row-fluid">
							<c:forEach items="${teachers[status1.count-1] }"
								var="steacher111" begin="${(status.count-1)*6 }"
								end="${(status.count)*6-1 }">
								<td><input type="checkbox" class='js${status1.count-1 }'
									tid='${steacher111.id }' /> <a
									href='<%=basePath%>backend/updateteacher/${steacher111.id }'>${steacher111.name
										}</a></td>
							</c:forEach>
						</tr>
					</c:forEach>
				</table>
				<table>
					<tr align="right">
						<td align="right"><button id='deletet'
								cclass='js${status1.count-1 }' class='deletet btn'>删除</button></td>
					</tr>
				</table>
			</div>

		</c:forEach>
		<c:forEach items="${types }" var="department" varStatus="status1">
			<div style="padding: 20px; font-size: 28px;">
				<ul class="nav nav-pills">
					<li class="active"><a href='#'
						style="width: 400px; text-align: center"> ${department.tName}
					</a></li>
				</ul>
			</div>
			<c:set var="length"
				value="${fn:length(teachers1[status1.count-1] ) }"></c:set>
			<div style="padding: 20px;">
				<table class='table table-bordered'
					style="background-color: #FAFAFA;">
					<c:forEach begin="1" end="${length }" step="6" varStatus="status">
						<tr class="row-fluid">
							<c:forEach items="${teachers1[status1.count-1] }"
								var="steacher111" begin="${(status.count-1)*6 }"
								end="${(status.count)*6-1 }">
								<td><input type="checkbox" class='hb${status1.count-1 }'
									tid='${steacher111.id }'  /> <a
									href='<%=basePath%>backend/updateteacher/${steacher111.id }'>${steacher111.name
										}</a></td>
							</c:forEach>
						</tr>
					</c:forEach>
				</table>
				<table>
					<tr align="right">
						<td align="right"><button id='deletet'
								cclass='hb${status1.count-1 }' class='deletet btn'>删除</button></td>
					</tr>
				</table>

			</div>

		</c:forEach>

	</div>
</div>
<!-- end of 师资队伍 -->
